home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 9 / Example 9.1 / mapObject.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-06-29  |  1.3 KB  |  45 lines

  1. #ifndef _MAP_OBJECT_
  2. #define _MAP_OBJECT_
  3.  
  4. #include "terrain.h"
  5. #include "intpoint.h"
  6. #include "mouse.h"
  7.  
  8. //Global Functions
  9. void LoadMapObjectResources(IDirect3DDevice9* Device);
  10. void UnloadMapObjectResources();
  11. INTPOINT GetScreenPos(D3DXVECTOR3 pos, IDirect3DDevice9* Device);
  12.  
  13.  
  14. class MAPOBJECT
  15. {
  16.     public:
  17.         //Functions
  18.         MAPOBJECT();                    //Set all variables to 0
  19.         RECT GetMapRect(int border);    //Get map rectangle + border
  20.         void PaintSelected();            //Paint selected
  21.  
  22.         //Virtual Functions
  23.         virtual void Render() = 0;
  24.         virtual void Update(float deltaTime) = 0;
  25.         virtual BBOX GetBoundingBox() = 0;        //Bounding box in world space
  26.         virtual D3DXMATRIX GetWorldMatrix() = 0;
  27.  
  28.         //Variables
  29.         TERRAIN *m_pTerrain;            //Used for unit pathfinding, building placement etc
  30.         int m_hp, m_hpMax;                //Health and max health
  31.         int m_range;                    //Attack range
  32.         int m_damage;
  33.         INTPOINT m_mappos, m_mapsize;    //Location and mapsize
  34.         float m_sightRadius;
  35.         int m_team, m_type;
  36.         bool m_selected, m_dead;
  37.         std::string m_name;
  38.         MAPOBJECT *m_pTarget;            //Used for targeting both units and buildings
  39.         D3DXVECTOR3 m_position;            //Actual world position
  40.         IDirect3DDevice9* m_pDevice;
  41.  
  42.         bool m_isBuilding;                //Used when casting pointers etc...
  43. };
  44.  
  45. #endif